package com.lopo.util;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * Created by MyWin on 2017/7/7.
 */
public class MD5Util {
    /**
     * 利用MD5进行加密
     */
    public static String EncoderByMd5(byte[] data) {
        //确定计算方法
        MessageDigest md5 = null;
        try {
            md5 = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return ByteUtil.BytesToHexString(md5.digest(data));
    }
}
